#! /bin/bash -e
#
cd $(dirname $0)/..
source ./auto/set-env-helpers

CONF_DIR="./terraform/$1"
mkdir -p ${CONF_DIR}/tmp
ssh-keygen -t rsa -P "" -f ${CONF_DIR}/tmp/id_rsa <<<y 2>&1 >/dev/null

terraform -chdir=${CONF_DIR} init
terraform -chdir=${CONF_DIR} apply -auto-approve

cp ${CONF_DIR}/tmp/kube-config.txt config/kube-config.txt
